package com.yunji.cabinet.device.factory;

import com.yunji.cabinet.device.DeviceCommandEngine;
import com.yunji.cabinet.device.ContainerTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class DeviceStrategyFactory {
    public static final String COFFEE = "CoffeeDeviceFacService";
    public static final String WIPE = "WipeDeviceFacService";

    private static  Map<String, DeviceCommandEngine> strategyMap;

    @Autowired
    protected  void setDeviceEngine(Map<String, DeviceCommandEngine>  strategyMap) {
        DeviceStrategyFactory.strategyMap = strategyMap;
    }

    public static DeviceCommandEngine getStrategy(String typeCode) {
        return strategyMap.get(ContainerTypeEnum.getService(typeCode));
    }

}
